﻿Imports UCBase
Imports System.Drawing
Imports System.Windows.Forms

Public Class Monitor
    Implements I_LoadSave
    Implements I_EditMode
    Private BackPic As New BackgroundCreator
    Private Mover As New Mover
    Private M_Edit As Boolean = True
    Private WithEvents ImageInput As I_ImageExchange
    Private PT As Integer
    Private AC As Integer = 0
    Private AV As Integer = 0
    Private FPS As Integer
    Private M_Font As New Font(System.Drawing.FontFamily.GenericSansSerif, 1, FontStyle.Bold, GraphicsUnit.Millimeter)
    Private OSD As Boolean = True

    Private Sub Monitor_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Me.Width = 375
        Me.Height = 250
    End Sub

    Public Sub New()
        InitializeComponent()
        Me.BackgroundImage = BackPic.CreatePic(Me.Width, Me.Height)
        Mover.Connect(Me)
        'Slider1.BackColor = Color.FromArgb(127, 0, 0, 0)
    End Sub
    Public Property EditMode() As Boolean
        Get
            Return M_Edit
        End Get
        Set(ByVal value As Boolean)
            M_Edit = value
            Mover.EditMode = value
        End Set
    End Property
    Private Sub Socket2_Connect() Handles Socket2.Connect
        If Socket2.SocketType = Socket.Socket_Type.Image Then
            Dim S As Socket = Socket2.Remote
            ImageInput = S.Parent
        End If
    End Sub

    Private Sub ImageInput_ImageOut(ByVal Image As System.Drawing.Bitmap) Handles ImageInput.ImageOut1
        If Image IsNot Nothing Then
            Dim TBMP As New Bitmap(Image)
            Dim G As Graphics = Graphics.FromImage(TBMP)
            InteractivePanel1.Image = TBMP
        End If
    End Sub

    Private Sub Socket2_Disconnected() Handles Socket2.Disconnected
        If Socket2.SocketType = Socket.Socket_Type.Image Then
            ImageInput = Nothing
        End If
        Socket2.SocketType = Socket.Socket_Type.Universal
    End Sub
    Public Function GetSettings() As String Implements UCBase.I_LoadSave.GetSettings
        Return ""
    End Function

    Public Sub SetSettings(ByVal Settings As String) Implements UCBase.I_LoadSave.SetSettings

    End Sub

    Public Sub SetEditMode(ByVal Mode As UCBase.Diagram.EditMode) Implements UCBase.I_EditMode.SetEditMode
        Mover.EditMode = Mode
    End Sub

End Class
